﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using TestApp.BookStore.Permissions;

namespace TestApp.BookStore.Books
{
    // 定义一个BookAppService类，继承CrudAppService类，用于处理书籍相关的业务逻辑
    public class BookAppService :
        CrudAppService<
            Book, 
            BookDto, 
            Guid, 
            PagedAndSortedResultRequestDto, 
            CreateUpdateBookDto>, 
        IBookAppService
    {
        // 构造函数，传入一个IRepository<Book, Guid>类型的参数
        public BookAppService(IRepository<Book, Guid> repositoty)
            : base(repositoty)
        {
            // 获取书籍权限名称
            GetPolicyName = BookStorePermissions.Books.Default;
            // 获取书籍列表权限名称
            GetListPolicyName = BookStorePermissions.Books.Default;
            // 创建书籍权限名称
            CreatePolicyName = BookStorePermissions.Books.Create;
            // 编辑书籍权限名称
            UpdatePolicyName = BookStorePermissions.Books.Edit;
            // 删除书籍权限名称
            DeletePolicyName = BookStorePermissions.Books.Delete;
        }
    }
}
